﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour {

    private Transform m_transform;
    private Transform m_player;

    public bool startFollow = false;

    private void Awake()
    {
        m_transform = GetComponent<Transform>();
        m_player = GameObject.FindWithTag("Player").GetComponent<Transform>();
        Screen.SetResolution(360, 640, false);
    }
	
	void Update () {
        CameraMove();

    }

    private void CameraMove()
    {
        if (startFollow)
        {
            Vector3 nextPos = new Vector3(m_transform.position.x, m_transform.position.y, m_player.position.z);
            //m_transform.position = nextPos;
            m_transform.position = Vector3.Lerp(m_transform.position, nextPos, Time.deltaTime);
        }
    }
}
